<template>
  <div class="layout">
    <el-container>
      <el-header>图书借阅系统 {{ name }}</el-header>
      <el-container>
        <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
          <el-menu>
            <el-menu-item index="/books">
              <router-link to="/books"><i class="el-icon-menu"></i></router-link>
              <span slot="title">查询馆藏</span>
            </el-menu-item>
          </el-menu>
          <el-menu>
            <el-menu-item index="/borrows">
              <router-link to="/borrows"><i class="el-icon-menu"></i></router-link>
              <span slot="title">我的借阅</span>

            </el-menu-item>
          </el-menu>
        </el-aside>
        <el-main>
          <!-- children router  -->
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'TheLayout',
  data() {
    return {
      name: ''
    }
  },
  beforeMount (){
    this.name = JSON.parse(localStorage.getItem("stu_info")).username
  },
  methods: {
    handleOpen() { 
      alert("click excute handleOpen")
    },
    handleClose() {
      alert("click excute handleClose")
     },
    close() {
      alert("click excute close")
     },
    open() { 
      alert("click excute open")
    }
  }
}
</script>

<style scoped>
 .layout {
  width: 100%;
  height: 100%;
  margin-left: 5%;
}

.el-container {
  height: 100%;
  width: 100%;
  height: 500px; 
  border: 1px solid #eee;
  }
  span {
    color: black;
  }
  /*
.el-container .el-aside {
  height: 100%;
  width: 100%;
} */
</style>